package com.wing.cabinet.model.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 领新申请表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("ord_stores_requisition")
public class StoresRequisition extends BaseEntity<StoresRequisition> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 待审核
        */
        toaudit(0,"待审核"),
        /**
        * 待领取
        */
        toreceive(1,"待领取"),
        /**
        * 已审核
        */
        checked(2,"已审核"),
        /**
         * 部分领取
         */
        portion(3,"部分领取"),
        /**
         * 已领完
         */
        broughtout(4,"已领完");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum CheckStatus implements IEnum<Integer> {

        /**
        * 审核通过
        */
        approve(0,"审核通过"),
        /**
        * 驳回待审核
        */
        reject(1,"驳回待审核"),
        /**
         * 待审核
         */
        toaudit(2,"待审核");

        private int code;
        private String desc;

        CheckStatus(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * day
     */
    private Integer day;

    /**
     * no
     */
    private Integer no;

    /**
     * 企业编号
     */
    private String enterpriseCode;

    /**
     * 领新申请编码
     */
    private String code;

    /**
     * 刀柜id
     */
    private Long cabinetId;

    /**
     * 工序id
     */
    private Long processId;

    /**
     * 工单id
     */
    private Long workOrderId;

    /**
     * 领取人id
     */
    private Long userId;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 审核状态
     */
    private CheckStatus checkStatus;

    /**
    * 审核状态描述
    */
    @TableField(exist = false)
    private String checkStatusDesc;

    public String getCheckStatusDesc() {
        return checkStatus == null ? null : checkStatus.getDesc();
    }

    /**
     * 审核人
     */
    private String auditPerson;
    /**
     * 指令密码
     */
    private Integer lnstructionCode;
    /**
     * 车间id
     */
    private Long workshopId;
    /**
     * 柜子编号
     */
    private String cabinetCode;
    /**
     * 申请时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime auditTime;
    /**
     * 审核描述
     */
    private String auditRemark;
    /**
     * 简版工单id
     */
    private Long simpleWorkOrderId;
    public enum WorkOrderWay implements IEnum<Integer> {

        /**
         * 来自MES
         */
        mes(0,"来自MES"),
        /**
         * 手动输入
         */
        manual(1,"手动输入"),
        /**
         * 简版管理
         */
        simple(2,"简版管理");

        private int code;
        private String desc;

        WorkOrderWay(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }
    /**
     * 工单方式
     */
    private WorkOrderWay workOrderWay;

    /**
     * 工单方式描述
     */
    @TableField(exist = false)
    private String workOrderWayDesc;

    public String getWorkOrderWayDesc() {
        return workOrderWay == null ? null : workOrderWay.getDesc();
    }


    private String uuid;
    private String uuidReject;
}
